//
//  SecondTwoCollectionViewCell.m
//  HandWork
//
//  Created by 王阳阳 on 16/1/26.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "SecondTwoCollectionViewCell.h"

@implementation SecondTwoCollectionViewCell

-(void)dealloc
{
    [_titlelabel release];
    [_price release];
    [_bgimg release];
    [_buy release];
    [super dealloc];
}
#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creat];
    }
    return self;
}
- (void)creat
{
    //图片
    self.bgimg = [[UIImageView alloc]init];
    [self.contentView addSubview:self.bgimg];
    [_bgimg release];
    
    //标题
    self.titlelabel = [[UILabel alloc]init];
    [self.contentView addSubview:self.titlelabel];
    [_titlelabel release];
    
    //价格
    self.price = [[UILabel alloc]init];
    [self.contentView addSubview:self.price];
    [_price release];
    
    //购买数量
    self.buy =  [[UILabel alloc]init];
    [self.contentView addSubview:self.buy];
    [_buy release];
}
#pragma mark - 布局
- (void)layoutSubviews
{
    [super layoutSubviews];
    /*****图片*****/
    self.bgimg.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width / 2 - 20, [UIScreen mainScreen].bounds.size.width / 2 - 20);
    
    /*****标题*****/
    self.titlelabel.frame = CGRectMake(0, self.bgimg.frame.size.height, [UIScreen mainScreen].bounds.size.width / 2 - 20, 40);
    self.titlelabel.font = [UIFont systemFontOfSize:14];//字体
    self.titlelabel.numberOfLines = 0;//不限行数
    /*****价格*****/
    self.price.frame = CGRectMake(0, self.titlelabel.frame.size.height + self.titlelabel.frame.origin.y, [UIScreen mainScreen].bounds.size.width / 5, 20);
    //字体颜色
    self.price.textColor = [UIColor redColor];
    /*****购买数量*****/
    self.buy.frame = CGRectMake(self.price.frame.size.width,self.titlelabel.frame.size.height + self.titlelabel.frame.origin.y , [UIScreen mainScreen].bounds.size.width / 5, 20);
    //字体大小
    self.buy.font = [UIFont systemFontOfSize:14];
    //字体颜色
    self.buy.textColor = [UIColor grayColor];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
